
#include <iostream>
#include <cstring>
using namespace std;

class Shape {
	public:
		void Draw( ) {
			cout << "Shape::Draw" << endl;
		}
		int m_x;
		int m_y;

};

class Rect : public Shape {
	public:
		void Draw( ) { cout << "Rect::Draw" << endl; }
		int m_rx;
		int m_ry;	
};

class Circle : public Shape {
	public:
		void Draw( ) { cout << "Circle::Draw" << endl; }
		int m_radius;
		void foo( ) {}
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) { 
	cout << "---- Call the class member function -----" << endl;
	Shape s;
	s.Draw( ); // Shape::Draw

	Rect r;
	r.Draw( ); // Rect::Draw

	Circle c;
	c.Draw( ); // Circle::Draw

	cout << "---- Call the class member function by pointer -----" << endl;
	// We can call the commenplace function by basic class.
	Shape* ps = &s;
	ps->Draw( ); // Shape::Draw
	 
	ps = &r;
	ps->Draw( ); // Shape::Draw

	ps = &c;
	ps->Draw( ); // Shape::Draw
// When you are using basic pointer there will be a error when you call the unique function in subclass.
//	ps->foo( );	err

	return 0;
}

